package com.jcodecraeer.xrecyclerview.progressindicator.indicator;

import ohos.agp.animation.Animator;
import ohos.agp.animation.AnimatorValue;

import java.util.ArrayList;
import java.util.List;

public class LineScalePulseOutIndicator extends LineScaleIndicator {
    @Override
    public List<Animator> createAnimation() {
        List<Animator> animators=new ArrayList<>();
        long[] delays=new long[]{500,250,0,250,500};
        for (int i = 0; i < 5; i++) {
            final int index=i;
            AnimatorValue scaleAnim = new AnimatorValue();
            scaleAnim.setDuration(900);
            scaleAnim.setDelay(delays[i]);
            scaleAnim.setLoopedCount(-1);
            scaleAnim.setValueUpdateListener(new AnimatorValue.ValueUpdateListener() {
                @Override
                public void onUpdate(AnimatorValue animatorValue, float v) {
                    scaleYFloats[index] = v;
                    postInvalidate();
                }
            });
            scaleAnim.start();
            animators.add(scaleAnim);
        }
        return animators;
    }
}
